<h1>Listing appointments</h1>

<%= link_to 'Home', root_path %> | <%= link_to 'New Appointment', new_appointment_path %>

</br>

<table border="1">
  <thead>
    <tr>
      <th>Patient</th>
      <th>Staff</th>
      <th colspan="2">Date and Time Appointment</th>
      <th>Status</th>
      <th>Registration Method</th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @appointments.each do |appointment| %>
      <tr>
        <td><%= link_to appointment.patient.full_name, patient_path(appointment.patient.id) %></td>
        <td><%= link_to appointment.staff.full_name, staff_path(appointment.staff.id) %></td>
        <td><%= appointment.date_appointment %></td>
        <td><%= appointment.time_appointment %></td>
        <td><%= appointment.appointment_status.label %></td>
        <td><%= appointment.registration_method.label %></td>
        <td><%= link_to 'Show', appointment %></td>
        <td><%= link_to 'Edit', edit_appointment_path(appointment) %></td>
        <td><%= link_to 'Destroy', appointment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>



